import logging
from gensim import models

logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s',
                    level=logging.INFO)

sentences = [['first', 'sentence'], ['second', 'sentence']]  # 将分好词的句子按列表形式输入
model = models.Word2Vec(sentences, min_count=1)  # 用以上句子训练词向量模型
print(model['sentence'])  # 输出单词sentence的词向量
